// if语句
var arr = ['lili', 'xiaoming', 'tom'];
if (arr[0] == 'xiaoming') {
    console.log('你是坏蛋');
}
else {
    console.log('好的');
}
// switch语句
var num = 20;
switch (true) {
    case num < 30:
        console.log('不及格');
        break;
    case num >= 50:
        console.log('刚好及格');
        break;
    default:
        console.log('hi');
        break;
}
var str = "A";
switch (str) {
    case 'A+':
        console.log('恭喜你得到最高荣誉');
        break;
    case 'A':
        console.log('恭喜你考的不错');
        break;
    case 'b+':
        console.log('还要在努力一些哦');
        break;
    case 'b':
        console.log('才刚刚及格哦');
        break;
    case 'c':
        console.log('还没有及格呢，进步的空间非常大');
        break;
    default:
        console.log('还没有评分');
        break;
}
// 循环
// while循环(有结束条件)先判断再循环
var i = 0;
var j;
while (i < 5) {
    j = i * 2;
    i++;
    console.log(j);
}
// do while (先循环在判断，即使条件不符，也至少会执行一次)
var i = 0;
var j;
do {
    j = i - 1;
    i++;
    console.log(j);
} while (i < 0);
// for
for (var i = 0; i <= 5; i++) {
    console.log(i);
}
// for in
var a;
var s = ['str', 'ing', 'sw'];
for (a in s) {
    console.log(s[a]);
}
var s1 = ['str', 2, 'sw'];
for (var a1 in s) {
    console.log(s1[a1]);
}
// for of
